/* ========================================================================= */
/* ------------------------------------------------------------------------- */
/*!
  \file			editimpl.h
  \date			Dec 2012
  \author		TNick

  \brief		Contains the definition for EditImpl class


*//*


 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Please read COPYING and README files in root folder
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
/* ------------------------------------------------------------------------- */
/* ========================================================================= */
#ifndef __EDITIMPL_INC__
#define __EDITIMPL_INC__
//
//
//
//
/*  INCLUDES    ------------------------------------------------------------ */

#include	<memtrack.h>
#include	<cpg/actions/editorbase.h>
#include	<QObject>
#include	<ui_edit.h>
#include    <QUndoGroup>


/*  INCLUDES    ============================================================ */
//
//
//
//
/*  CLASS    --------------------------------------------------------------- */

class	ActionsHost;
class	QMenu;
class	QToolBar;

/**
*	@brief
*/
class EditImpl				: public QObject, public MemTrack	{
	Q_OBJECT
	BBM_TRACK( EditImpl )

	//
	//
	//
	//
	/*  DEFINITIONS    ----------------------------------------------------- */

	/*  DEFINITIONS    ===================================================== */
	//
	//
	//
	//
	/*  DATA    ------------------------------------------------------------ */

private:

	/**
	*	@brief
	*/
	Ui::Edit			ui_;


	/**
	*	@brief	the host
	*/
	ActionsHost *		host_;


	/**
	*	@brief	undo group
	*/
	QUndoGroup			undogr_;


	/*  DATA    ============================================================ */
	//
	//
	//
	//
	/*  FUNCTIONS    ------------------------------------------------------- */

public:


	/**
	*	@brief	constructor;
	*/
	EditImpl			( QObject * parent = NULL );



	/**
	*	@brief	destructor;
	*/
	virtual				~EditImpl		( void );


	/**
	*	@brief	initialisation
	*/
	bool				init			( ActionsHost * host );


	/**
	*	@brief	termination
	*/
	void				end				( void );



	/**
	*	@brief	inserts the actions in the menu
	*/
	void				initMenu		( QMenu * menu );


	/**
	*	@brief	inserts the actions in the contextual menu
	*/
	void				initCtxMenu		( QMenu * menu );


	/**
	*	@brief	inserts the actions in the toolbar
	*/
	void				initToolbar		( QToolBar * menu );



public slots:


	/**
	*	@brief	cut the selection in active document
	*/
	void				slot_Cut            	( void );


	/**
	*	@brief	copy the selection in active document
	*/
	void				slot_Copy            	( void );


	/**
	*	@brief	paste content of the clipboard in active document
	*/
	void				slot_Paste            	( void );


	/**
	*	@brief	delete the selection in active document
	*/
	void				slot_Delete            	( void );


	/**
	*	@brief	select entire content of the active document
	*/
	void				slot_SelAll            	( void );


	/**
	*	@brief	fired when the current editor changes
	*/
	void				activeEditorChanged		( EditorBase * ed );


	/**
	*	@brief	fired when a document editor is created
	*/
	void				editorCreated			( EditorBase * ed );


	/**
	*	@brief	request to show find dialog
	*/
	void				showFind				( void );


	/**
	*	@brief	an editor is being closed
	*
	*	At this point the process is irreversible.
	*/
	void				editorClosing			( EditorBase * ed );


	/**
	*	@brief	fired when cursor moves in active editor or active editor changes
	*/
	void				editorCursorMoved		(
			EditorBase *				ed,
			bool						b_with_sel
			);


private slots:


	/**
	*	@brief	visibility of the find widget changed in an editor
	*/
	void				findVisibilityChanged	( bool b_on );


signals:


	/**
	*	@brief	request to show preferences
	*/
	void				showPrefs				( void );


	/*  FUNCTIONS    ======================================================= */
	//
	//
	//
	//

};	/*	class EditImpl	*/

/*  CLASS    =============================================================== */
//
//
//
//
#endif // __EDITIMPL_INC__
/* ------------------------------------------------------------------------- */
/* ========================================================================= */
